<?php
/**
 * Created by PhpStorm.
 * User: gwl
 * Date: 16/9/18
 * Time: 上午1:04
 */

namespace app\api\controller;



use think\Cache;

use think\Controller;
use think\Response;
class BaseController extends Controller
{

    function __construct()
    {
        if (isset($_POST['token'])){
            $token = $_POST['token'];
            if ($info = Cache::get($token)){
            }else{
                return $this->response((['success'=>false,'msg'=>'token错误','data'=>[]]));
            }
        }else{
            return $this->response((['success'=>false,'msg'=>'token错误','data'=>[]]));
        }
        return $this->response((['success'=>false,'msg'=>'token错误','data'=>[]]));

    }

    protected function response($data, $type = 'json', $code = 200)
    {
        return Response::create($data, $type,200,['Access-Control-Allow-Origin'=>'*'])->code($code);
    }





}